<?php
class model_newagk_adminrole extends gdl_components_basemodel 
{

    public function primarykey() {
        return 'id';
    }

    public function tableName() {
        return 'agk_admin_role';
    }
	
	public function getInfoArg($arrg=[],$field)
    {
		if(empty($arrg)) return false;
		return $this->select($arrg, $field)->items;
    }
	
	public function getLIst($unitsid,$platform_id)
    {
		$list = [];
		$role = $this->getInfoArg(['platform_id'=>$platform_id,'units'=>$unitsid],'id,name');
		foreach($role as $v){
			$list[$v['id']] = [
							'id'=>$v['id'],
							'title'=>$v['name'],
							'units'=>$unitsid,
							'children'=>[],
								]; 
		}
		
		return $list;
    }
	
	public function getLIstadmin($platform_id)
    {
		$list = [];
		$role = $this->getInfoArg(['platform_id'=>$platform_id,'name'=>'Administrator','status'=>1],'id,name,units');
		foreach($role as $v){
			$list[$v['units']] = $v['id'];
								
		}
		
		return $list;
    }
	
	
	
}
